<?php

include_once ('../../__global.php');
class sys_notice extends ml_controller 
{
    private $page = 1;
    private $pagesize = 10;
    
    
    public function init()
    {
        $this->set_access(self::ACCESS_SELF , self::NOACCESS_REDIRECT );
    }
    public function initParam()
    {
        $this->page = abs((int)$this->input('page' , 'g' , 1));
    }

    public function checkParam()
    {
        
        
    }
    public function main()
    {
        $uid = $this->__visitor['uid'];
        ml_tool_actionlog::add_other_action($this->__visitor['uid'] , ML_SINAACTCODE_VIEW_HOME_SYSNOTICE);
        
        if($this->page == 1)
        {
            $oRds = new ml_model_rdsNotice();
            $oRds->clean_one_field($uid , ml_model_rdsNotice::NTCTYPE_ADDSYSNOTICE  );
        }
        //获取用户名片信息        
        $obizUser = ml_biz_user_getinfo::get_instance();
        $obizUser->initUser($uid , $uid);
        $arr = $obizUser->getUserArea();
        $data = array();
        $data = array_merge($data,$arr);
        
        
        $oSysNtc = new ml_model_dbSysNoticeRel();
        $oSysNtcC = new ml_model_dbSysNoticeContent();
        
        $oSysNtc->getTotalByUid($uid);
        $total = $oSysNtc->get_data();
        
        $rs = $oSysNtc->getListByUid($uid , $this->page , $this->pagesize);
        $aRow = $oSysNtc->get_data();
        if(count($aRow) > 0)
        {
            foreach ($aRow as $row)
            {
                $aCid[] = $row['content_id'];
            }
            
            $oSysNtcC->get_in_id($aCid);
            $aNtcC = $oSysNtcC->get_data();
        }
        
        $data['total'] = $total;
        $data['rows'] = $aNtcC;
        
        $this->page_output('user::sys_notice' , $data);
    }
    
    
}
new sys_notice();